package com.ruoyi.system.outto.goods.impl;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.exception.GlobalException;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.http.HttpUtils;
import com.ruoyi.system.V2.gameAttr.mapper.GameAttrTemplateMapper;
import com.ruoyi.system.V2.gameAttr.mapper.GameAttributeMapper;
import com.ruoyi.system.V2.goodInfo.mapper.GoodsInfoImgMapper;
import com.ruoyi.system.V2.inter.mapper.ArtRecMapper;
import com.ruoyi.system.interAttr.domain.InterAttr;
import com.ruoyi.system.interAttr.mapper.InterAttrMapper;
import com.ruoyi.system.model.domain.*;
import com.ruoyi.system.model.dto.GoodsInfoAndAttrValueDto;
import com.ruoyi.system.outto.core.LCConstant;
import com.ruoyi.system.outto.core.MapUntils;
import com.ruoyi.system.outto.dto.HttpUtil;
import com.ruoyi.system.outto.goods.NEWSHENXIANAPI;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.beanutils.ConvertUtils;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.lang.reflect.Field;
import java.util.*;
import java.util.stream.Collectors;

/**
 * @author lz
 * @version 1.0
 * @date 2022/6/5 16:19
 */
@Slf4j
@Service
public class NEWSHENXIANAPIImpl implements NEWSHENXIANAPI {
    @Resource
    private GoodsInfoImgMapper goodsInfoImgMapper;
    @Resource
    private GameAttributeMapper gameAttributeMapper;
    @Resource
    private ArtRecMapper artRecMapper;
    @Resource
    InterAttrMapper interAttrMapper;
    @Resource
    private GameAttrTemplateMapper gameAttrTemplateMapper;

    @Override
    public AjaxResult addGame(GoodsInfoAndAttrValueDto goodsInfoAndAttrValueDto, SalePartner salePartner) {
        Map<String, Object> params = params(goodsInfoAndAttrValueDto, "1", salePartner);
        Map<String, Object> result = new HashMap<>();
        String response = HttpUtils.doPostForm("http://interface.sxds.com/api/goods/goodsReceive", params, null);
        log.info("神仙添加接口请求参数={}", JSONObject.toJSONString(params));
        log.info("神仙添加接口返回参数={}", response);
        JSONObject resultJson = JSONObject.parseObject(response);
        String msg = resultJson.getString("msg");
        if (!Objects.isNull(resultJson)) {
            if (!"0".equals(resultJson.getString("code")) && !msg.contains("该商品已存在")) {
                result.put("code", 500);
            } else {
                result.put("code", 200);
                result.put("outId", String.valueOf(goodsInfoAndAttrValueDto.getId()));
                if (msg.contains("该商品已存在")) {
                    Map<String, Object> params2 = params(goodsInfoAndAttrValueDto, "2", salePartner);
                    response = HttpUtils.doPostForm("http://interface.sxds.com/api/goods/goodsReceive", params2, null);
                    resultJson = JSONObject.parseObject(response);
                    if("0".equals(resultJson.getString("code"))){
                        result.put("outId", String.valueOf(goodsInfoAndAttrValueDto.getId()));
                    }
                }
            }
            result.put("msg", resultJson.getString("msg"));
        } else {
            result.put("code", 500);
            result.put("msg", "添加失败");
        }
        result.put("req", JSONObject.toJSONString(params));
        result.put("res", response);
        return AjaxResult.success(result);
    }

    @Override
    public AjaxResult editGame(GoodsInfoAndAttrValueDto goodsInfoAndAttrValueDto, SalePartner salePartner) {
        if(goodsInfoAndAttrValueDto.getSaleState()!=1){
            throw new GlobalException("当前商品不是未售状态 不可编辑!!!"+"编辑时间"+ DateUtils.getTime());
        }
        Map<String, Object> params = params(goodsInfoAndAttrValueDto, "2", salePartner);
        Map<String, Object> result = new HashMap<>();
        String response = HttpUtils.doPostForm("http://interface.sxds.com/api/goods/goodsReceive", params, null);
        log.info("神仙修改接口请求参数={}", JSONObject.toJSONString(params));
        log.info("神仙修改接口返回参数={}", response);
        JSONObject resultJson = JSONObject.parseObject(response);
        if (!Objects.isNull(resultJson)) {
            if (!"0".equals(resultJson.getString("code"))) {
                result.put("code", 500);
            } else {
                result.put("code", 200);
            }
            result.put("msg", resultJson.getString("msg"));
        } else {
            result.put("code", 500);
            result.put("msg", "编辑失败");
        }
        result.put("req", JSONObject.toJSONString(params));
        result.put("res", response);
        return AjaxResult.success(result);
    }


    private Map<String, Object> params(GoodsInfoAndAttrValueDto goodsInfoAndAttrValueDto, String type, SalePartner salePartner) {
        Map<String, Object> params = new TreeMap<>();
        params.put("operation", type);
        params.put("ensureOpen", "1");
        if(salePartner.getSaleKey().equals("100232")) {
            params.put("securitService", "3,6,7,9,1,2,4,8");
        }else {
            params.put("securitService", "5,6,4,8");
        }
        params.put("apiSuffix", salePartner.getTwoOther());
        if (!type.equals("1")) {
            if (type.equals("2")) {
                params.put("showSign", 0);
            } else {
                params.put("showSign", 2);
            }
            ArtRec artRecreq = new ArtRec();
            artRecreq.setConfig(salePartner.getId());
            artRecreq.setAccountId(goodsInfoAndAttrValueDto.getId());
            List<ArtRec> artRecs = artRecMapper.selectArtRecList(artRecreq);
            params.put("outSn", CollectionUtils.isNotEmpty(artRecs) ? artRecs.get(0).getOutid() : goodsInfoAndAttrValueDto.getId());
        } else {
            params.put("outSn", goodsInfoAndAttrValueDto.getId());
        }
        params.put("goodsTypeId", "1");

        if (goodsInfoAndAttrValueDto.getGameName().equals("王者荣耀")) {
            params.put("gameId", "3");
            if (goodsInfoAndAttrValueDto.getSystemName().equals("安卓")) {
                if (goodsInfoAndAttrValueDto.getCarrierName().equals("QQ")) {
                    params.put("areaId", "108");
                    params.put("serverId", "4039");
                } else {
                    params.put("areaId", "107");
                    params.put("serverId", "4038");
                }
            } else {
                if (goodsInfoAndAttrValueDto.getCarrierName().equals("QQ")) {
                    params.put("areaId", "109");
                    params.put("serverId", "4040");
                } else {
                    params.put("areaId", "106");
                    params.put("serverId", "4037");
                }
            }
        }
        else if (goodsInfoAndAttrValueDto.getGameName().equals("和平精英")) {
            params.put("gameId", "56");
            if (goodsInfoAndAttrValueDto.getSystemName().equals("安卓")) {
                params.put("areaId", "185");
                if (goodsInfoAndAttrValueDto.getCarrierName().equals("QQ")) {
                    params.put("serverId", "8052");
                } else {
                    params.put("serverId", "8051");
                }
            } else {
                params.put("areaId", "184");
                if (goodsInfoAndAttrValueDto.getCarrierName().equals("QQ")) {
                    params.put("serverId", "8050");
                } else {
                    params.put("serverId", "8049");
                }
            }
        }
        else if (goodsInfoAndAttrValueDto.getGameName().equals("枪战王者")) {
            params.put("gameId", "64");
            if (goodsInfoAndAttrValueDto.getSystemName().equals("安卓")) {
                params.put("areaId", "176");
                if (goodsInfoAndAttrValueDto.getCarrierName().equals("QQ")) {
                    params.put("serverId", "4036");
                } else {
                    params.put("serverId", "4035");
                }
            } else {
                params.put("areaId", "175");
                if (goodsInfoAndAttrValueDto.getCarrierName().equals("QQ")) {
                    params.put("serverId", "4034");
                } else {
                    params.put("serverId", "4033");
                }
            }
        }
        else if (goodsInfoAndAttrValueDto.getGameName().equals("原神")) {
            params.put("gameId", "69");
            if (goodsInfoAndAttrValueDto.getCarrierName().equals("游戏官方")) {
                params.put("areaId", "282");
                params.put("serverId", "8102");
            } else {
                params.put("areaId", "330");
                params.put("serverId", "8527");
            }
        }
        else if (goodsInfoAndAttrValueDto.getGameName().equals("火影忍者")) {
            params.put("gameId", "61");
            String regional = goodsInfoAndAttrValueDto.getSystemName() + goodsInfoAndAttrValueDto.getCarrierName();
            if (regional.equals("安卓QQ")) {
                params.put("areaId", "183");
                params.put("serverId", "7049");
            } else if (regional.equals("安卓微信")) {
                params.put("areaId", "181");
                params.put("serverId", "5049");
            } else if (regional.equals("苹果QQ")) {
                params.put("areaId", "182");
                params.put("serverId", "6055");
            } else {
                params.put("areaId", "180");
                params.put("serverId", "4049");
            }
        }
        else if (goodsInfoAndAttrValueDto.getGameName().contains("逆水寒")){
            params.put("gameId", "153");
            String areas = "[{\"fieldId\":2,\"specialId\":697,\"specialName\":\"逐中原\",\"specialKey\":\"areaId\",\"specialValue\":\"\",\"single\":0,\"sort\":100,\"secondOptions\":[{\"id\":41412,\"specialId\":0,\"twoSpecialId\":16988,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"东京梦华\",\"twospecialValue\":\"\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":5},{\"id\":41413,\"specialId\":0,\"twoSpecialId\":16989,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"挑灯看剑\",\"twospecialValue\":\"\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":4},{\"id\":41414,\"specialId\":0,\"twoSpecialId\":16990,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"九天揽月\",\"twospecialValue\":\"\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":3},{\"id\":41415,\"specialId\":0,\"twoSpecialId\":16991,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"铁马秋风\",\"twospecialValue\":\"\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":2},{\"id\":41416,\"specialId\":0,\"twoSpecialId\":16992,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"应看千秋\",\"twospecialValue\":\"\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":1}]},{\"fieldId\":2,\"specialId\":698,\"specialName\":\"忆江南\",\"specialKey\":\"areaId\",\"specialValue\":\"\",\"single\":0,\"sort\":22,\"secondOptions\":[{\"id\":41417,\"specialId\":0,\"twoSpecialId\":16993,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"烟雨江南\",\"twospecialValue\":\"\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":5},{\"id\":41418,\"specialId\":0,\"twoSpecialId\":16994,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"西子湖畔\",\"twospecialValue\":\"\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":4},{\"id\":41419,\"specialId\":0,\"twoSpecialId\":16995,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"姑苏绮罗\",\"twospecialValue\":\"\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":3},{\"id\":41420,\"specialId\":0,\"twoSpecialId\":16996,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"魔都风云\",\"twospecialValue\":\"\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":2},{\"id\":41421,\"specialId\":0,\"twoSpecialId\":16997,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"碧海问舟\",\"twospecialValue\":\"\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":1}]},{\"fieldId\":2,\"specialId\":699,\"specialName\":\"将进酒\",\"specialKey\":\"areaId\",\"specialValue\":\"\",\"single\":0,\"sort\":20,\"secondOptions\":[{\"id\":41422,\"specialId\":0,\"twoSpecialId\":16998,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"群龙之首\",\"twospecialValue\":\"\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":5},{\"id\":41423,\"specialId\":0,\"twoSpecialId\":16999,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"天下无双\",\"twospecialValue\":\"\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":4},{\"id\":41424,\"specialId\":0,\"twoSpecialId\":17000,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"问鼎江湖\",\"twospecialValue\":\"\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":3},{\"id\":41425,\"specialId\":0,\"twoSpecialId\":17001,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"武林萌主\",\"twospecialValue\":\"\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":2},{\"id\":41426,\"specialId\":0,\"twoSpecialId\":17002,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"神龙九现\",\"twospecialValue\":\"\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":1}]},{\"fieldId\":2,\"specialId\":700,\"specialName\":\"踏北尘\",\"specialKey\":\"areaId\",\"specialValue\":\"\",\"single\":0,\"sort\":18,\"secondOptions\":[{\"id\":41427,\"specialId\":0,\"twoSpecialId\":17003,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"紫禁之巅\",\"twospecialValue\":\"\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":5},{\"id\":41428,\"specialId\":0,\"twoSpecialId\":17004,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"武林天骄\",\"twospecialValue\":\"\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":4},{\"id\":41429,\"specialId\":0,\"twoSpecialId\":17005,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"瑶光听雪\",\"twospecialValue\":\"\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":3},{\"id\":41430,\"specialId\":0,\"twoSpecialId\":17006,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"帝都风云\",\"twospecialValue\":\"\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":2},{\"id\":41431,\"specialId\":0,\"twoSpecialId\":17007,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"云川雪青\",\"twospecialValue\":\"\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":1}]},{\"fieldId\":2,\"specialId\":701,\"specialName\":\"如梦令\",\"specialKey\":\"areaId\",\"specialValue\":\"\",\"single\":0,\"sort\":16,\"secondOptions\":[{\"id\":41432,\"specialId\":0,\"twoSpecialId\":17008,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"江湖一梦\",\"twospecialValue\":\"\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":5},{\"id\":41433,\"specialId\":0,\"twoSpecialId\":17009,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"刀剑如梦\",\"twospecialValue\":\"\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":4},{\"id\":41434,\"specialId\":0,\"twoSpecialId\":17010,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"浮生若梦\",\"twospecialValue\":\"\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":3},{\"id\":41435,\"specialId\":0,\"twoSpecialId\":17011,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"仲夏绮梦\",\"twospecialValue\":\"\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":2},{\"id\":41436,\"specialId\":0,\"twoSpecialId\":17012,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"游园惊梦\",\"twospecialValue\":\"\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":1}]},{\"fieldId\":2,\"specialId\":702,\"specialName\":\"蝶恋花\",\"specialKey\":\"areaId\",\"specialValue\":\"\",\"single\":0,\"sort\":14,\"secondOptions\":[{\"id\":41437,\"specialId\":0,\"twoSpecialId\":17013,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"宿命相逢\",\"twospecialValue\":\"\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":5},{\"id\":41438,\"specialId\":0,\"twoSpecialId\":17014,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"缘定三生\",\"twospecialValue\":\"\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":4},{\"id\":41439,\"specialId\":0,\"twoSpecialId\":17015,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"明月天涯\",\"twospecialValue\":\"\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":3},{\"id\":41440,\"specialId\":0,\"twoSpecialId\":17016,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"惊鸿照影\",\"twospecialValue\":\"\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":2},{\"id\":41441,\"specialId\":0,\"twoSpecialId\":17017,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"踏月留香\",\"twospecialValue\":\"\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":1}]},{\"fieldId\":2,\"specialId\":703,\"specialName\":\"决南岭\",\"specialKey\":\"areaId\",\"specialValue\":\"\",\"single\":0,\"sort\":12,\"secondOptions\":[{\"id\":41442,\"specialId\":0,\"twoSpecialId\":17018,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"江山如画\",\"twospecialValue\":\"\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":5},{\"id\":41443,\"specialId\":0,\"twoSpecialId\":17019,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"一蓑烟雨\",\"twospecialValue\":\"\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":4},{\"id\":41444,\"specialId\":0,\"twoSpecialId\":17020,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"两广豪杰\",\"twospecialValue\":\"\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":3},{\"id\":41445,\"specialId\":0,\"twoSpecialId\":17021,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"沧海月明\",\"twospecialValue\":\"\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":2},{\"id\":41446,\"specialId\":0,\"twoSpecialId\":17022,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"君心如月\",\"twospecialValue\":\"\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":1}]},{\"fieldId\":2,\"specialId\":704,\"specialName\":\"逍遥游\",\"specialKey\":\"areaId\",\"specialValue\":\"\",\"single\":0,\"sort\":10,\"secondOptions\":[{\"id\":41447,\"specialId\":0,\"twoSpecialId\":17023,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"千古风流\",\"twospecialValue\":\"\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":5},{\"id\":41448,\"specialId\":0,\"twoSpecialId\":17024,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"扶摇万里\",\"twospecialValue\":\"\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":4},{\"id\":41449,\"specialId\":0,\"twoSpecialId\":17025,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"飞花逐月\",\"twospecialValue\":\"\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":3},{\"id\":41450,\"specialId\":0,\"twoSpecialId\":17026,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"剑胆琴心\",\"twospecialValue\":\"\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":2},{\"id\":41451,\"specialId\":0,\"twoSpecialId\":17027,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"白帝霜华\",\"twospecialValue\":\"\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":1}]},{\"fieldId\":2,\"specialId\":705,\"specialName\":\"定风波\",\"specialKey\":\"areaId\",\"specialValue\":\"\",\"single\":0,\"sort\":8,\"secondOptions\":[{\"id\":41452,\"specialId\":0,\"twoSpecialId\":17028,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"千里婵娟\",\"twospecialValue\":\"\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":5},{\"id\":41453,\"specialId\":0,\"twoSpecialId\":17029,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"翩若惊鸿\",\"twospecialValue\":\"\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":4},{\"id\":41454,\"specialId\":0,\"twoSpecialId\":17030,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"金风玉露\",\"twospecialValue\":\"\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":3},{\"id\":41455,\"specialId\":0,\"twoSpecialId\":17031,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"佳期如梦\",\"twospecialValue\":\"\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":2},{\"id\":41456,\"specialId\":0,\"twoSpecialId\":17032,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"雪泥鸿爪\",\"twospecialValue\":\"\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":1}]},{\"fieldId\":2,\"specialId\":706,\"specialName\":\"望海潮\",\"specialKey\":\"areaId\",\"specialValue\":\"\",\"single\":0,\"sort\":6,\"secondOptions\":[{\"id\":41457,\"specialId\":0,\"twoSpecialId\":17033,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"日月同辉\",\"twospecialValue\":\"\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":5},{\"id\":41458,\"specialId\":0,\"twoSpecialId\":17034,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"九州风雷\",\"twospecialValue\":\"\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":4},{\"id\":41459,\"specialId\":0,\"twoSpecialId\":17035,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"满堂花醉\",\"twospecialValue\":\"\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":3},{\"id\":41460,\"specialId\":0,\"twoSpecialId\":17036,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"凭栏听雨\",\"twospecialValue\":\"\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":2},{\"id\":41461,\"specialId\":0,\"twoSpecialId\":17037,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"白夜拂雪\",\"twospecialValue\":\"\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":1}]},{\"fieldId\":2,\"specialId\":707,\"specialName\":\"凌西川\",\"specialKey\":\"areaId\",\"specialValue\":\"\",\"single\":0,\"sort\":4,\"secondOptions\":[{\"id\":41462,\"specialId\":0,\"twoSpecialId\":17038,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"天府之国\",\"twospecialValue\":\"\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":5},{\"id\":41463,\"specialId\":0,\"twoSpecialId\":17039,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"天外飞仙\",\"twospecialValue\":\"\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":4},{\"id\":41464,\"specialId\":0,\"twoSpecialId\":17040,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"玲珑相思\",\"twospecialValue\":\"\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":3},{\"id\":41465,\"specialId\":0,\"twoSpecialId\":17041,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"绝代风华\",\"twospecialValue\":\"\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":2},{\"id\":41466,\"specialId\":0,\"twoSpecialId\":17042,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"燕字归时\",\"twospecialValue\":\"\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":1}]},{\"fieldId\":2,\"specialId\":708,\"specialName\":\"渠道服\",\"specialKey\":\"areaId\",\"specialValue\":\"\",\"single\":0,\"sort\":2,\"secondOptions\":[{\"id\":41467,\"specialId\":0,\"twoSpecialId\":17043,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"春风十里\",\"twospecialValue\":\"\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":11},{\"id\":41468,\"specialId\":0,\"twoSpecialId\":17044,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"谁主沉浮\",\"twospecialValue\":\"\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":10},{\"id\":41469,\"specialId\":0,\"twoSpecialId\":17045,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"湖光水镜\",\"twospecialValue\":\"\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":9},{\"id\":41470,\"specialId\":0,\"twoSpecialId\":17046,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"风云再起\",\"twospecialValue\":\"\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":8},{\"id\":41471,\"specialId\":0,\"twoSpecialId\":17047,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"剑指天下\",\"twospecialValue\":\"\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":7},{\"id\":41472,\"specialId\":0,\"twoSpecialId\":17048,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"雷霆万钧\",\"twospecialValue\":\"\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":6},{\"id\":41473,\"specialId\":0,\"twoSpecialId\":17049,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"高山流水\",\"twospecialValue\":\"\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":5},{\"id\":41474,\"specialId\":0,\"twoSpecialId\":17050,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"对酒狂歌\",\"twospecialValue\":\"\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":4},{\"id\":41475,\"specialId\":0,\"twoSpecialId\":17051,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"折梅煮酒\",\"twospecialValue\":\"\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":3},{\"id\":41476,\"specialId\":0,\"twoSpecialId\":17052,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"诗酒华章\",\"twospecialValue\":\"\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":2},{\"id\":41477,\"specialId\":0,\"twoSpecialId\":17053,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"云天自在\",\"twospecialValue\":\"\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":1}]}]\n";
            JSONArray jsonArray = JSONArray.parseArray(areas);
            for(Object o : jsonArray){
                String secondOptions = JSONObject.parseObject(o.toString()).getString("secondOptions");
                JSONArray jsonArray1 = JSONArray.parseArray(secondOptions);
                for(Object p : jsonArray1) {
                    if (JSONObject.parseObject(p.toString()).getString("twoSpecialName").equals(goodsInfoAndAttrValueDto.getServerName())) {
                        params.put("areaId", JSONObject.parseObject(o.toString()).getString("specialId"));
                        params.put("serverId",JSONObject.parseObject(p.toString()).getString("twoSpecialId"));
                        break;
                    }
                }
            }
            if(Objects.isNull(params.get("areaId"))){
                throw new GlobalException("区服匹配失败!!!区服:"+goodsInfoAndAttrValueDto.getGroupName()+"==="+goodsInfoAndAttrValueDto.getServerName());
            }
        }
        else if(goodsInfoAndAttrValueDto.getGameName().equals("元梦之星")){
            params.put("gameId", "163");
            if (goodsInfoAndAttrValueDto.getSystemName().equals("安卓")) {
                if (goodsInfoAndAttrValueDto.getCarrierName().equals("QQ")) {
                    params.put("areaId", "791");
                    params.put("serverId", "17568");
                } else {
                    params.put("areaId", "791");
                    params.put("serverId", "17569");
                }
            } else {
                if (goodsInfoAndAttrValueDto.getCarrierName().equals("QQ")) {
                    params.put("areaId", "792");
                    params.put("serverId", "17570");
                } else {
                    params.put("areaId", "792");
                    params.put("serverId", "17571");
                }
            }
        }
        else if(goodsInfoAndAttrValueDto.getGameName().equals("无畏契约")){
            params.put("gameId", "150");
            if (goodsInfoAndAttrValueDto.getGroupName().equals("QQ")) {
                params.put("areaId", "786");
                params.put("serverId", "16126");
            } else {
                params.put("areaId", "786");
                params.put("serverId", "16127");
            }
        }
        else if(goodsInfoAndAttrValueDto.getGameName().equals("英雄联盟(手游)")){
            params.put("gameId", "95");
            if (goodsInfoAndAttrValueDto.getSystemName().equals("安卓")) {
                if (goodsInfoAndAttrValueDto.getCarrierName().equals("QQ")) {
                    params.put("areaId", "407");
                    params.put("serverId", "9052");
                } else {
                    params.put("areaId", "408");
                    params.put("serverId", "9053");
                }
            } else {
                if (goodsInfoAndAttrValueDto.getCarrierName().equals("QQ")) {
                    params.put("areaId", "409");
                    params.put("serverId", "9054");
                } else {
                    params.put("areaId", "410");
                    params.put("serverId", "9055");
                }
            }
        }
        else if(goodsInfoAndAttrValueDto.getGameName().equals("英雄联盟")){
            params.put("gameId", "4");
            String string = "[{\"fieldId\":2,\"specialId\":33,\"specialName\":\"电信区\",\"specialKey\":\"areaId\",\"specialValue\":\"33\",\"single\":0,\"sort\":20,\"secondOptions\":[{\"id\":23684,\"specialId\":1,\"twoSpecialId\":137,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"影流\",\"twospecialValue\":\"137\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":23688,\"specialId\":1,\"twoSpecialId\":141,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"皮城警备\",\"twospecialValue\":\"141\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":23687,\"specialId\":1,\"twoSpecialId\":140,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"卡拉曼达\",\"twospecialValue\":\"140\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":23686,\"specialId\":1,\"twoSpecialId\":139,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"征服之海\",\"twospecialValue\":\"139\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":23685,\"specialId\":1,\"twoSpecialId\":138,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"守望之海\",\"twospecialValue\":\"138\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":23670,\"specialId\":1,\"twoSpecialId\":123,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"艾欧尼亚\",\"twospecialValue\":\"123\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":23683,\"specialId\":1,\"twoSpecialId\":136,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"均衡教派\",\"twospecialValue\":\"136\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":23682,\"specialId\":1,\"twoSpecialId\":135,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"水晶之痕\",\"twospecialValue\":\"135\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":23681,\"specialId\":1,\"twoSpecialId\":134,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"雷瑟守备\",\"twospecialValue\":\"134\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":23680,\"specialId\":1,\"twoSpecialId\":133,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"巨神峰\",\"twospecialValue\":\"133\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":23679,\"specialId\":1,\"twoSpecialId\":132,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"战争学院\",\"twospecialValue\":\"132\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":23678,\"specialId\":1,\"twoSpecialId\":131,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"皮尔特沃夫\",\"twospecialValue\":\"131\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":23677,\"specialId\":1,\"twoSpecialId\":130,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"诺克萨斯\",\"twospecialValue\":\"130\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":23676,\"specialId\":1,\"twoSpecialId\":129,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"祖安\",\"twospecialValue\":\"129\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":23675,\"specialId\":1,\"twoSpecialId\":128,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"黑色玫瑰\",\"twospecialValue\":\"128\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":23674,\"specialId\":1,\"twoSpecialId\":127,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"钢铁烈阳\",\"twospecialValue\":\"127\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":23673,\"specialId\":1,\"twoSpecialId\":126,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"裁决之地\",\"twospecialValue\":\"126\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":23672,\"specialId\":1,\"twoSpecialId\":125,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"班德尔城\",\"twospecialValue\":\"125\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":23671,\"specialId\":1,\"twoSpecialId\":124,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"暗影岛\",\"twospecialValue\":\"124\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0}]},{\"fieldId\":2,\"specialId\":34,\"specialName\":\"网通区\",\"specialKey\":\"areaId\",\"specialValue\":\"34\",\"single\":0,\"sort\":19,\"secondOptions\":[{\"id\":23697,\"specialId\":3,\"twoSpecialId\":148,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"巨龙之巢\",\"twospecialValue\":\"148\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":23696,\"specialId\":3,\"twoSpecialId\":147,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"扭曲丛林\",\"twospecialValue\":\"147\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":23695,\"specialId\":3,\"twoSpecialId\":146,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"恕瑞玛\",\"twospecialValue\":\"146\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":23694,\"specialId\":3,\"twoSpecialId\":145,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"无畏先锋\",\"twospecialValue\":\"145\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":23693,\"specialId\":3,\"twoSpecialId\":144,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"弗雷尔卓德\",\"twospecialValue\":\"144\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":23692,\"specialId\":3,\"twoSpecialId\":143,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"德玛西亚\",\"twospecialValue\":\"143\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":23691,\"specialId\":3,\"twoSpecialId\":142,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"比尔吉沃特\",\"twospecialValue\":\"142\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0}]},{\"fieldId\":2,\"specialId\":35,\"specialName\":\"其他\",\"specialKey\":\"areaId\",\"specialValue\":\"35\",\"single\":0,\"sort\":18,\"secondOptions\":[{\"id\":23698,\"specialId\":4,\"twoSpecialId\":149,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"教育网专区\",\"twospecialValue\":\"149\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0}]},{\"fieldId\":2,\"specialId\":36,\"specialName\":\"全网络大区\",\"specialKey\":\"areaId\",\"specialValue\":\"36\",\"single\":0,\"sort\":17,\"secondOptions\":[{\"id\":23700,\"specialId\":5,\"twoSpecialId\":151,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"峡谷之巅\",\"twospecialValue\":\"151\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":23699,\"specialId\":5,\"twoSpecialId\":150,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"男爵领域\",\"twospecialValue\":\"150\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0}]}]\n";
            JSONArray jsonArray = JSONArray.parseArray(string);
            for(Object o : jsonArray){
                String secondOptions = JSONObject.parseObject(o.toString()).getString("secondOptions");
                JSONArray jsonArray1 = JSONArray.parseArray(secondOptions);
                for(Object p : jsonArray1){
                    if(goodsInfoAndAttrValueDto.getServerName().equals(JSONObject.parseObject(p.toString()).getString("twoSpecialName"))){
                        params.put("areaId", JSONObject.parseObject(o.toString()).getString("specialId"));
                        params.put("serverId", JSONObject.parseObject(p.toString()).getString("twoSpecialId"));
                        break;
                    }
                }
            }
        }
        else if(goodsInfoAndAttrValueDto.getGameName().equals("穿越火线")){
            params.put("gameId", "5");
            String string = "[{\"fieldId\":4,\"specialId\":37,\"specialName\":\"电信区\",\"specialKey\":\"areaId\",\"specialValue\":\"37\",\"single\":0,\"sort\":20,\"secondOptions\":[{\"id\":23723,\"specialId\":1,\"twoSpecialId\":174,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"浙江二区\",\"twospecialValue\":\"174\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":23724,\"specialId\":1,\"twoSpecialId\":175,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"重庆一区\",\"twospecialValue\":\"175\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":23722,\"specialId\":1,\"twoSpecialId\":173,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"浙江一区\",\"twospecialValue\":\"173\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":23712,\"specialId\":1,\"twoSpecialId\":163,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"江苏一区\",\"twospecialValue\":\"163\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":23702,\"specialId\":1,\"twoSpecialId\":153,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"福建一区\",\"twospecialValue\":\"153\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":23703,\"specialId\":1,\"twoSpecialId\":154,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"广东一区\",\"twospecialValue\":\"154\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":23704,\"specialId\":1,\"twoSpecialId\":155,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"广东二区\",\"twospecialValue\":\"155\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":23705,\"specialId\":1,\"twoSpecialId\":156,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"广东三区\",\"twospecialValue\":\"156\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":23706,\"specialId\":1,\"twoSpecialId\":157,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"广东四区\",\"twospecialValue\":\"157\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":23707,\"specialId\":1,\"twoSpecialId\":158,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"广西一区\",\"twospecialValue\":\"158\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":23708,\"specialId\":1,\"twoSpecialId\":159,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"湖北一区\",\"twospecialValue\":\"159\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":23709,\"specialId\":1,\"twoSpecialId\":160,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"湖北二区\",\"twospecialValue\":\"160\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":23710,\"specialId\":1,\"twoSpecialId\":161,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"湖南一区\",\"twospecialValue\":\"161\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":23711,\"specialId\":1,\"twoSpecialId\":162,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"湖南二区\",\"twospecialValue\":\"162\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":23701,\"specialId\":1,\"twoSpecialId\":152,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"安徽一区\",\"twospecialValue\":\"152\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":23713,\"specialId\":1,\"twoSpecialId\":164,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"江苏二区\",\"twospecialValue\":\"164\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":23714,\"specialId\":1,\"twoSpecialId\":165,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"江西一区\",\"twospecialValue\":\"165\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":23715,\"specialId\":1,\"twoSpecialId\":166,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"南方大区\",\"twospecialValue\":\"166\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":23716,\"specialId\":1,\"twoSpecialId\":167,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"陕西一区\",\"twospecialValue\":\"167\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":23717,\"specialId\":1,\"twoSpecialId\":168,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"上海一区\",\"twospecialValue\":\"168\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":23718,\"specialId\":1,\"twoSpecialId\":169,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"上海二区\",\"twospecialValue\":\"169\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":23719,\"specialId\":1,\"twoSpecialId\":170,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"四川一区\",\"twospecialValue\":\"170\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":23720,\"specialId\":1,\"twoSpecialId\":171,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"四川二区\",\"twospecialValue\":\"171\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":23721,\"specialId\":1,\"twoSpecialId\":172,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"云南一区\",\"twospecialValue\":\"172\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0}]},{\"fieldId\":4,\"specialId\":38,\"specialName\":\"网通区\",\"specialKey\":\"areaId\",\"specialValue\":\"38\",\"single\":0,\"sort\":19,\"secondOptions\":[{\"id\":23733,\"specialId\":2,\"twoSpecialId\":184,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"黑龙江区\",\"twospecialValue\":\"184\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":23725,\"specialId\":2,\"twoSpecialId\":176,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"北方大区\",\"twospecialValue\":\"176\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":23726,\"specialId\":2,\"twoSpecialId\":177,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"北京一区\",\"twospecialValue\":\"177\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":23727,\"specialId\":2,\"twoSpecialId\":178,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"北京二区\",\"twospecialValue\":\"178\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":23728,\"specialId\":2,\"twoSpecialId\":179,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"北京三区\",\"twospecialValue\":\"179\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":23729,\"specialId\":2,\"twoSpecialId\":180,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"北京四区\",\"twospecialValue\":\"180\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":23730,\"specialId\":2,\"twoSpecialId\":181,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"河北一区\",\"twospecialValue\":\"181\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":23731,\"specialId\":2,\"twoSpecialId\":182,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"河南一区\",\"twospecialValue\":\"182\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":23732,\"specialId\":2,\"twoSpecialId\":183,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"河南二区\",\"twospecialValue\":\"183\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":23734,\"specialId\":2,\"twoSpecialId\":185,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"吉林一区\",\"twospecialValue\":\"185\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":23735,\"specialId\":2,\"twoSpecialId\":186,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"辽宁一区\",\"twospecialValue\":\"186\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":23736,\"specialId\":2,\"twoSpecialId\":187,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"辽宁二区\",\"twospecialValue\":\"187\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":23737,\"specialId\":2,\"twoSpecialId\":188,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"辽宁三区\",\"twospecialValue\":\"188\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":23738,\"specialId\":2,\"twoSpecialId\":189,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"山东一区\",\"twospecialValue\":\"189\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":23739,\"specialId\":2,\"twoSpecialId\":190,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"山东二区\",\"twospecialValue\":\"190\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":23740,\"specialId\":2,\"twoSpecialId\":191,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"山西一区\",\"twospecialValue\":\"191\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0}]},{\"fieldId\":4,\"specialId\":39,\"specialName\":\"体验区\",\"specialKey\":\"areaId\",\"specialValue\":\"39\",\"single\":0,\"sort\":18,\"secondOptions\":[{\"id\":23741,\"specialId\":3,\"twoSpecialId\":192,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"高清竞技大区\",\"twospecialValue\":\"192\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0}]},{\"fieldId\":4,\"specialId\":98,\"specialName\":\"其他大区\",\"specialKey\":\"areaId\",\"specialValue\":\"98\",\"single\":0,\"sort\":17,\"secondOptions\":[{\"id\":23742,\"specialId\":4,\"twoSpecialId\":1310,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"教育网专区\",\"twospecialValue\":\"1310\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":23743,\"specialId\":4,\"twoSpecialId\":1311,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"移动专区\",\"twospecialValue\":\"1311\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0}]}]\n";
            JSONArray jsonArray = JSONArray.parseArray(string);
            for(Object o : jsonArray){
                String secondOptions = JSONObject.parseObject(o.toString()).getString("secondOptions");
                JSONArray jsonArray1 = JSONArray.parseArray(secondOptions);
                for(Object p : jsonArray1){
                    if(goodsInfoAndAttrValueDto.getServerName().equals(JSONObject.parseObject(p.toString()).getString("twoSpecialName"))){
                        params.put("areaId", JSONObject.parseObject(o.toString()).getString("specialId"));
                        params.put("serverId", JSONObject.parseObject(p.toString()).getString("twoSpecialId"));
                        break;
                    }
                }
            }
        }
        else if(goodsInfoAndAttrValueDto.getGameName().equals("永劫无间")){
            params.put("gameId", "86");
            if(goodsInfoAndAttrValueDto.getGroupName().equals("网易")){
                params.put("areaId", "373");
                params.put("serverId", "8715");
            }else if(goodsInfoAndAttrValueDto.getGroupName().equals("Steam")){
                params.put("areaId", "374");
                params.put("serverId", "8716");
            }else {
                params.put("areaId", "506");
                params.put("serverId", "10676");
            }
        }
        else if(goodsInfoAndAttrValueDto.getGameName().equals("地下城与勇士")){
            params.put("gameId", "1");
            String areas = "[{\"fieldId\":9,\"specialId\":1,\"specialName\":\"广东区\",\"specialKey\":\"areaId\",\"specialValue\":\"1\",\"single\":0,\"sort\":15,\"secondOptions\":[{\"id\":22348,\"specialId\":1,\"twoSpecialId\":1,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"广东1区\",\"twospecialValue\":\"1\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":22349,\"specialId\":1,\"twoSpecialId\":2,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"广东2区\",\"twospecialValue\":\"2\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":22350,\"specialId\":1,\"twoSpecialId\":3,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"广东3区\",\"twospecialValue\":\"3\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":22351,\"specialId\":1,\"twoSpecialId\":4,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"广东4区\",\"twospecialValue\":\"4\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":22352,\"specialId\":1,\"twoSpecialId\":5,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"广东5区\",\"twospecialValue\":\"5\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":22353,\"specialId\":1,\"twoSpecialId\":6,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"广东6区\",\"twospecialValue\":\"6\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":22354,\"specialId\":1,\"twoSpecialId\":7,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"广东7区\",\"twospecialValue\":\"7\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":22355,\"specialId\":1,\"twoSpecialId\":8,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"广东8区\",\"twospecialValue\":\"8\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":22356,\"specialId\":1,\"twoSpecialId\":9,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"广东9区\",\"twospecialValue\":\"9\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":22357,\"specialId\":1,\"twoSpecialId\":10,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"广东10区\",\"twospecialValue\":\"10\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":22358,\"specialId\":1,\"twoSpecialId\":11,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"广东11区\",\"twospecialValue\":\"11\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":22359,\"specialId\":1,\"twoSpecialId\":12,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"广东12区\",\"twospecialValue\":\"12\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":22360,\"specialId\":1,\"twoSpecialId\":13,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"广东13区\",\"twospecialValue\":\"13\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":22361,\"specialId\":1,\"twoSpecialId\":14,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"广州1/2区\",\"twospecialValue\":\"14\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0}]},{\"fieldId\":9,\"specialId\":2,\"specialName\":\"四川区\",\"specialKey\":\"areaId\",\"specialValue\":\"2\",\"single\":0,\"sort\":15,\"secondOptions\":[{\"id\":22362,\"specialId\":2,\"twoSpecialId\":15,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"四川1区\",\"twospecialValue\":\"15\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":22363,\"specialId\":2,\"twoSpecialId\":16,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"四川2区\",\"twospecialValue\":\"16\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":22364,\"specialId\":2,\"twoSpecialId\":17,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"四川3区\",\"twospecialValue\":\"17\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":22365,\"specialId\":2,\"twoSpecialId\":18,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"四川4区\",\"twospecialValue\":\"18\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":22366,\"specialId\":2,\"twoSpecialId\":19,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"四川5区\",\"twospecialValue\":\"19\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":22367,\"specialId\":2,\"twoSpecialId\":20,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"四川6区\",\"twospecialValue\":\"20\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0}]},{\"fieldId\":9,\"specialId\":3,\"specialName\":\"北京区\",\"specialKey\":\"areaId\",\"specialValue\":\"3\",\"single\":0,\"sort\":15,\"secondOptions\":[{\"id\":22368,\"specialId\":3,\"twoSpecialId\":21,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"北京1区\",\"twospecialValue\":\"21\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":22369,\"specialId\":3,\"twoSpecialId\":22,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"北京2/4区\",\"twospecialValue\":\"22\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":22370,\"specialId\":3,\"twoSpecialId\":23,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"北京3区\",\"twospecialValue\":\"23\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0}]},{\"fieldId\":9,\"specialId\":4,\"specialName\":\"湖北区\",\"specialKey\":\"areaId\",\"specialValue\":\"4\",\"single\":0,\"sort\":15,\"secondOptions\":[{\"id\":22371,\"specialId\":4,\"twoSpecialId\":24,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"湖北1区\",\"twospecialValue\":\"24\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":22372,\"specialId\":4,\"twoSpecialId\":25,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"湖北2区\",\"twospecialValue\":\"25\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":22373,\"specialId\":4,\"twoSpecialId\":26,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"湖北3区\",\"twospecialValue\":\"26\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":22374,\"specialId\":4,\"twoSpecialId\":27,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"湖北4区\",\"twospecialValue\":\"27\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":22375,\"specialId\":4,\"twoSpecialId\":28,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"湖北5区\",\"twospecialValue\":\"28\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":22376,\"specialId\":4,\"twoSpecialId\":29,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"湖北6区\",\"twospecialValue\":\"29\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":22377,\"specialId\":4,\"twoSpecialId\":30,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"湖北7区\",\"twospecialValue\":\"30\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":22378,\"specialId\":4,\"twoSpecialId\":31,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"湖北8区\",\"twospecialValue\":\"31\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0}]},{\"fieldId\":9,\"specialId\":5,\"specialName\":\"江苏区\",\"specialKey\":\"areaId\",\"specialValue\":\"5\",\"single\":0,\"sort\":15,\"secondOptions\":[{\"id\":22379,\"specialId\":5,\"twoSpecialId\":32,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"江苏1区\",\"twospecialValue\":\"32\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":22380,\"specialId\":5,\"twoSpecialId\":33,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"江苏2区\",\"twospecialValue\":\"33\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":22381,\"specialId\":5,\"twoSpecialId\":34,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"江苏3区\",\"twospecialValue\":\"34\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":22382,\"specialId\":5,\"twoSpecialId\":35,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"江苏4区\",\"twospecialValue\":\"35\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":22383,\"specialId\":5,\"twoSpecialId\":36,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"江苏5/7区\",\"twospecialValue\":\"36\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":22384,\"specialId\":5,\"twoSpecialId\":37,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"江苏6区\",\"twospecialValue\":\"37\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":22385,\"specialId\":5,\"twoSpecialId\":38,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"江苏8区\",\"twospecialValue\":\"38\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0}]},{\"fieldId\":9,\"specialId\":6,\"specialName\":\"广西区\",\"specialKey\":\"areaId\",\"specialValue\":\"6\",\"single\":0,\"sort\":15,\"secondOptions\":[{\"id\":22386,\"specialId\":6,\"twoSpecialId\":39,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"广西1区\",\"twospecialValue\":\"39\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":22387,\"specialId\":6,\"twoSpecialId\":40,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"广西2/4区\",\"twospecialValue\":\"40\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":22388,\"specialId\":6,\"twoSpecialId\":41,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"广西3区\",\"twospecialValue\":\"41\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":22389,\"specialId\":6,\"twoSpecialId\":42,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"广西5区\",\"twospecialValue\":\"42\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0}]},{\"fieldId\":9,\"specialId\":7,\"specialName\":\"东北区\",\"specialKey\":\"areaId\",\"specialValue\":\"7\",\"single\":0,\"sort\":15,\"secondOptions\":[{\"id\":22390,\"specialId\":7,\"twoSpecialId\":43,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"东北1区\",\"twospecialValue\":\"43\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":22391,\"specialId\":7,\"twoSpecialId\":44,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"东北2区\",\"twospecialValue\":\"44\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":22392,\"specialId\":7,\"twoSpecialId\":45,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"东北3/7区\",\"twospecialValue\":\"45\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":22393,\"specialId\":7,\"twoSpecialId\":46,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"东北4/5/6区\",\"twospecialValue\":\"46\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0}]},{\"fieldId\":9,\"specialId\":8,\"specialName\":\"浙江区\",\"specialKey\":\"areaId\",\"specialValue\":\"8\",\"single\":0,\"sort\":15,\"secondOptions\":[{\"id\":22394,\"specialId\":8,\"twoSpecialId\":47,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"浙江1区\",\"twospecialValue\":\"47\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":22395,\"specialId\":8,\"twoSpecialId\":48,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"浙江2区\",\"twospecialValue\":\"48\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":22396,\"specialId\":8,\"twoSpecialId\":49,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"浙江3区\",\"twospecialValue\":\"49\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":22397,\"specialId\":8,\"twoSpecialId\":50,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"浙江4/5区\",\"twospecialValue\":\"50\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":22398,\"specialId\":8,\"twoSpecialId\":51,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"浙江6区\",\"twospecialValue\":\"51\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":22399,\"specialId\":8,\"twoSpecialId\":52,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"浙江7区\",\"twospecialValue\":\"52\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0}]},{\"fieldId\":9,\"specialId\":9,\"specialName\":\"山东区\",\"specialKey\":\"areaId\",\"specialValue\":\"9\",\"single\":0,\"sort\":15,\"secondOptions\":[{\"id\":22400,\"specialId\":9,\"twoSpecialId\":53,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"山东1区\",\"twospecialValue\":\"53\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":22401,\"specialId\":9,\"twoSpecialId\":54,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"山东2/7区\",\"twospecialValue\":\"54\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":22402,\"specialId\":9,\"twoSpecialId\":55,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"山东3区\",\"twospecialValue\":\"55\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":22403,\"specialId\":9,\"twoSpecialId\":56,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"山东4区\",\"twospecialValue\":\"56\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":22404,\"specialId\":9,\"twoSpecialId\":57,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"山东5区\",\"twospecialValue\":\"57\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":22405,\"specialId\":9,\"twoSpecialId\":58,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"山东6区\",\"twospecialValue\":\"58\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0}]},{\"fieldId\":9,\"specialId\":10,\"specialName\":\"上海区\",\"specialKey\":\"areaId\",\"specialValue\":\"10\",\"single\":0,\"sort\":15,\"secondOptions\":[{\"id\":22406,\"specialId\":10,\"twoSpecialId\":59,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"上海1区\",\"twospecialValue\":\"59\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":22407,\"specialId\":10,\"twoSpecialId\":60,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"上海2区\",\"twospecialValue\":\"60\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":22408,\"specialId\":10,\"twoSpecialId\":61,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"上海3区\",\"twospecialValue\":\"61\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":22409,\"specialId\":10,\"twoSpecialId\":62,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"上海4/5区\",\"twospecialValue\":\"62\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0}]},{\"fieldId\":9,\"specialId\":11,\"specialName\":\"河南区\",\"specialKey\":\"areaId\",\"specialValue\":\"11\",\"single\":0,\"sort\":15,\"secondOptions\":[{\"id\":22410,\"specialId\":11,\"twoSpecialId\":63,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"河南1区\",\"twospecialValue\":\"63\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":22411,\"specialId\":11,\"twoSpecialId\":64,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"河南2区\",\"twospecialValue\":\"64\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":22412,\"specialId\":11,\"twoSpecialId\":65,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"河南3区\",\"twospecialValue\":\"65\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":22413,\"specialId\":11,\"twoSpecialId\":66,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"河南4区\",\"twospecialValue\":\"66\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":22414,\"specialId\":11,\"twoSpecialId\":67,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"河南5区\",\"twospecialValue\":\"67\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":22415,\"specialId\":11,\"twoSpecialId\":68,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"河南6区\",\"twospecialValue\":\"68\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":22416,\"specialId\":11,\"twoSpecialId\":69,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"河南7区\",\"twospecialValue\":\"69\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0}]},{\"fieldId\":9,\"specialId\":12,\"specialName\":\"安徽区\",\"specialKey\":\"areaId\",\"specialValue\":\"12\",\"single\":0,\"sort\":15,\"secondOptions\":[{\"id\":22417,\"specialId\":12,\"twoSpecialId\":70,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"安徽1区\",\"twospecialValue\":\"70\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":22418,\"specialId\":12,\"twoSpecialId\":71,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"安徽2区\",\"twospecialValue\":\"71\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":22419,\"specialId\":12,\"twoSpecialId\":72,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"安徽3区\",\"twospecialValue\":\"72\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0}]},{\"fieldId\":9,\"specialId\":13,\"specialName\":\"河北区\",\"specialKey\":\"areaId\",\"specialValue\":\"13\",\"single\":0,\"sort\":15,\"secondOptions\":[{\"id\":22420,\"specialId\":13,\"twoSpecialId\":73,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"河北1区\",\"twospecialValue\":\"73\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":22421,\"specialId\":13,\"twoSpecialId\":74,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"河北2/3区\",\"twospecialValue\":\"74\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":22422,\"specialId\":13,\"twoSpecialId\":75,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"河北4区\",\"twospecialValue\":\"75\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":22423,\"specialId\":13,\"twoSpecialId\":76,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"河北5区\",\"twospecialValue\":\"76\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0}]},{\"fieldId\":9,\"specialId\":14,\"specialName\":\"西南区\",\"specialKey\":\"areaId\",\"specialValue\":\"14\",\"single\":0,\"sort\":15,\"secondOptions\":[{\"id\":22424,\"specialId\":14,\"twoSpecialId\":77,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"西南1区\",\"twospecialValue\":\"77\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":22425,\"specialId\":14,\"twoSpecialId\":78,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"西南2区\",\"twospecialValue\":\"78\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":22426,\"specialId\":14,\"twoSpecialId\":79,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"西南3区\",\"twospecialValue\":\"79\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0}]},{\"fieldId\":9,\"specialId\":15,\"specialName\":\"山西区\",\"specialKey\":\"areaId\",\"specialValue\":\"15\",\"single\":0,\"sort\":15,\"secondOptions\":[{\"id\":22427,\"specialId\":15,\"twoSpecialId\":80,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"山西1区\",\"twospecialValue\":\"80\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":22428,\"specialId\":15,\"twoSpecialId\":81,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"山西2区\",\"twospecialValue\":\"81\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0}]},{\"fieldId\":9,\"specialId\":16,\"specialName\":\"天津区\",\"specialKey\":\"areaId\",\"specialValue\":\"16\",\"single\":0,\"sort\":15,\"secondOptions\":[{\"id\":22429,\"specialId\":16,\"twoSpecialId\":82,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"天津1区\",\"twospecialValue\":\"82\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0}]},{\"fieldId\":9,\"specialId\":17,\"specialName\":\"湖南区\",\"specialKey\":\"areaId\",\"specialValue\":\"17\",\"single\":0,\"sort\":15,\"secondOptions\":[{\"id\":22430,\"specialId\":17,\"twoSpecialId\":83,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"湖南1区\",\"twospecialValue\":\"83\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":22431,\"specialId\":17,\"twoSpecialId\":84,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"湖南2区\",\"twospecialValue\":\"84\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":22432,\"specialId\":17,\"twoSpecialId\":85,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"湖南3区\",\"twospecialValue\":\"85\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":22433,\"specialId\":17,\"twoSpecialId\":86,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"湖南4区\",\"twospecialValue\":\"86\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":22434,\"specialId\":17,\"twoSpecialId\":87,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"湖南5区\",\"twospecialValue\":\"87\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":22435,\"specialId\":17,\"twoSpecialId\":88,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"湖南6区\",\"twospecialValue\":\"88\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":22436,\"specialId\":17,\"twoSpecialId\":89,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"湖南7区\",\"twospecialValue\":\"89\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0}]},{\"fieldId\":9,\"specialId\":18,\"specialName\":\"云贵区\",\"specialKey\":\"areaId\",\"specialValue\":\"18\",\"single\":0,\"sort\":15,\"secondOptions\":[{\"id\":22437,\"specialId\":18,\"twoSpecialId\":90,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"云贵1区\",\"twospecialValue\":\"90\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":22438,\"specialId\":18,\"twoSpecialId\":91,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"云南1区\",\"twospecialValue\":\"91\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":22439,\"specialId\":18,\"twoSpecialId\":92,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"贵州1区\",\"twospecialValue\":\"92\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0}]},{\"fieldId\":9,\"specialId\":19,\"specialName\":\"内蒙古区\",\"specialKey\":\"areaId\",\"specialValue\":\"19\",\"single\":0,\"sort\":15,\"secondOptions\":[{\"id\":22440,\"specialId\":19,\"twoSpecialId\":93,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"内蒙古1区\",\"twospecialValue\":\"93\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0}]},{\"fieldId\":9,\"specialId\":20,\"specialName\":\"新疆区\",\"specialKey\":\"areaId\",\"specialValue\":\"20\",\"single\":0,\"sort\":15,\"secondOptions\":[{\"id\":22441,\"specialId\":20,\"twoSpecialId\":94,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"新疆1区\",\"twospecialValue\":\"94\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0}]},{\"fieldId\":9,\"specialId\":21,\"specialName\":\"福建区\",\"specialKey\":\"areaId\",\"specialValue\":\"21\",\"single\":0,\"sort\":15,\"secondOptions\":[{\"id\":22442,\"specialId\":21,\"twoSpecialId\":95,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"福建1区\",\"twospecialValue\":\"95\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":22443,\"specialId\":21,\"twoSpecialId\":96,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"福建2区\",\"twospecialValue\":\"96\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":22444,\"specialId\":21,\"twoSpecialId\":97,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"福建3/4区\",\"twospecialValue\":\"97\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0}]},{\"fieldId\":9,\"specialId\":22,\"specialName\":\"辽宁区\",\"specialKey\":\"areaId\",\"specialValue\":\"22\",\"single\":0,\"sort\":15,\"secondOptions\":[{\"id\":22445,\"specialId\":22,\"twoSpecialId\":98,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"辽宁1区\",\"twospecialValue\":\"98\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":22446,\"specialId\":22,\"twoSpecialId\":99,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"辽宁2区\",\"twospecialValue\":\"99\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":22447,\"specialId\":22,\"twoSpecialId\":100,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"辽宁3区\",\"twospecialValue\":\"100\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0}]},{\"fieldId\":9,\"specialId\":23,\"specialName\":\"华北区\",\"specialKey\":\"areaId\",\"specialValue\":\"23\",\"single\":0,\"sort\":15,\"secondOptions\":[{\"id\":22448,\"specialId\":23,\"twoSpecialId\":101,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"华北1区\",\"twospecialValue\":\"101\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":22449,\"specialId\":23,\"twoSpecialId\":102,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"华北2区\",\"twospecialValue\":\"102\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":22450,\"specialId\":23,\"twoSpecialId\":103,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"华北3区\",\"twospecialValue\":\"103\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":22451,\"specialId\":23,\"twoSpecialId\":104,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"华北4区\",\"twospecialValue\":\"104\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0}]},{\"fieldId\":9,\"specialId\":24,\"specialName\":\"西北区\",\"specialKey\":\"areaId\",\"specialValue\":\"24\",\"single\":0,\"sort\":15,\"secondOptions\":[{\"id\":22452,\"specialId\":24,\"twoSpecialId\":105,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"西北1区\",\"twospecialValue\":\"105\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":22453,\"specialId\":24,\"twoSpecialId\":106,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"西北2/3区\",\"twospecialValue\":\"106\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0}]},{\"fieldId\":9,\"specialId\":25,\"specialName\":\"江西区\",\"specialKey\":\"areaId\",\"specialValue\":\"25\",\"single\":0,\"sort\":15,\"secondOptions\":[{\"id\":22454,\"specialId\":25,\"twoSpecialId\":107,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"江西1区\",\"twospecialValue\":\"107\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":22455,\"specialId\":25,\"twoSpecialId\":108,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"江西2区\",\"twospecialValue\":\"108\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":22456,\"specialId\":25,\"twoSpecialId\":109,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"江西3区\",\"twospecialValue\":\"109\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0}]},{\"fieldId\":9,\"specialId\":26,\"specialName\":\"黑龙江区\",\"specialKey\":\"areaId\",\"specialValue\":\"26\",\"single\":0,\"sort\":15,\"secondOptions\":[{\"id\":22457,\"specialId\":26,\"twoSpecialId\":110,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"黑龙江1区\",\"twospecialValue\":\"110\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":22458,\"specialId\":26,\"twoSpecialId\":111,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"黑龙江2/3区\",\"twospecialValue\":\"111\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0}]},{\"fieldId\":9,\"specialId\":27,\"specialName\":\"陕西区\",\"specialKey\":\"areaId\",\"specialValue\":\"27\",\"single\":0,\"sort\":15,\"secondOptions\":[{\"id\":22459,\"specialId\":27,\"twoSpecialId\":112,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"陕西1区\",\"twospecialValue\":\"112\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":22460,\"specialId\":27,\"twoSpecialId\":113,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"陕西2/3区\",\"twospecialValue\":\"113\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0}]},{\"fieldId\":9,\"specialId\":28,\"specialName\":\"吉林区\",\"specialKey\":\"areaId\",\"specialValue\":\"28\",\"single\":0,\"sort\":15,\"secondOptions\":[{\"id\":22461,\"specialId\":28,\"twoSpecialId\":114,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"吉林1/2区\",\"twospecialValue\":\"114\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0}]},{\"fieldId\":9,\"specialId\":29,\"specialName\":\"重庆区\",\"specialKey\":\"areaId\",\"specialValue\":\"29\",\"single\":0,\"sort\":15,\"secondOptions\":[{\"id\":22462,\"specialId\":29,\"twoSpecialId\":115,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"重庆1区\",\"twospecialValue\":\"115\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":22463,\"specialId\":29,\"twoSpecialId\":116,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"重庆2区\",\"twospecialValue\":\"116\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0}]},{\"fieldId\":9,\"specialId\":30,\"specialName\":\"体验服\",\"specialKey\":\"areaId\",\"specialValue\":\"30\",\"single\":0,\"sort\":15,\"secondOptions\":[{\"id\":22464,\"specialId\":30,\"twoSpecialId\":117,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"格兰之森1\",\"twospecialValue\":\"117\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0},{\"id\":22465,\"specialId\":30,\"twoSpecialId\":118,\"twoSpecialKey\":\"serverId\",\"twoSpecialName\":\"格兰之森2\",\"twospecialValue\":\"118\",\"single\":0,\"twoSpecialUrl\":\"\",\"sort\":0}]}]\n";
            JSONArray jsonArray = JSONArray.parseArray(areas);
            for(Object o : jsonArray){
                String secondOptions = JSONObject.parseObject(o.toString()).getString("secondOptions");
                JSONArray jsonArray1 = JSONArray.parseArray(secondOptions);
                for(Object p : jsonArray1){
                    if(JSONObject.parseObject(p.toString()).getString("twoSpecialName").equals(goodsInfoAndAttrValueDto.getServerName())){
                        params.put("areaId", JSONObject.parseObject(o.toString()).getString("specialId"));
                        params.put("serverId", JSONObject.parseObject(p.toString()).getString("twoSpecialId"));
                        break;
                    }
                }
            }
        }
        else if(goodsInfoAndAttrValueDto.getGameName().equals("地下城与勇士手游")){
            params.put("gameId", "193");
            //区服未配置
//            if(goodsInfoAndAttrValueDto.getGroupName().equals("QQ")) {
//                params.put("areaId", "716");
//                params.put("serverId", "16303");
//            }else {
//                params.put("areaId", "715");
//                params.put("serverId", "16302");
//            }
        }
        else if(goodsInfoAndAttrValueDto.getGameName().equals("永劫无间手游")){
            params.put("gameId", "198");
            params.put("areaId", "1060");
            params.put("serverId", "20048");
        }
        else if(goodsInfoAndAttrValueDto.getGameName().equals("QQ飞车手游")){
            params.put("gameId", "66");
            String regional = goodsInfoAndAttrValueDto.getSystemName()+goodsInfoAndAttrValueDto.getCarrierName();
            if(regional.equals("安卓QQ")) {
                params.put("areaId", "507");
                params.put("serverId", "10677");
            }else if(regional.equals("安卓微信")) {
                params.put("areaId", "508");
                params.put("serverId", "11479");
            }else if(regional.equals("苹果QQ")) {
                params.put("areaId", "509");
                params.put("serverId", "11078");
            }else {
                params.put("areaId", "510");
                params.put("serverId", "11880");
            }
        }
        else if(goodsInfoAndAttrValueDto.getGameName().equals("QQ飞车端游")){
            params.put("gameId", "65");
            params.put("areaId", "511");
            if(goodsInfoAndAttrValueDto.getGroupName().equals("电信")) {
                params.put("serverId", "12281");
            }else {
                params.put("serverId", "12283");
            }
        }
        else if(goodsInfoAndAttrValueDto.getGameName().equals("金铲铲之战")){
            params.put("gameId", "55");
            if (goodsInfoAndAttrValueDto.getSystemName().equals("安卓")) {
                if (goodsInfoAndAttrValueDto.getCarrierName().equals("QQ")) {
                    params.put("areaId", "556");
                    params.put("serverId", "13357");
                } else {
                    params.put("areaId", "557");
                    params.put("serverId", "13376");
                }
            } else {
                if (goodsInfoAndAttrValueDto.getCarrierName().equals("QQ")) {
                    params.put("areaId", "558");
                    params.put("serverId", "13398");
                } else {
                    params.put("areaId", "559");
                    params.put("serverId", "13420");
                }
            }
        }
        else if(goodsInfoAndAttrValueDto.getGameName().equals("暗区突围")){
            params.put("gameId", "174");
            if (goodsInfoAndAttrValueDto.getSystemName().equals("安卓")) {
                if (goodsInfoAndAttrValueDto.getCarrierName().equals("QQ")) {
                    params.put("areaId", "949");
                    params.put("serverId", "17954");
                } else {
                    params.put("areaId", "950");
                    params.put("serverId", "17955");
                }
            } else {
                if (goodsInfoAndAttrValueDto.getCarrierName().equals("QQ")) {
                    params.put("areaId", "947");
                    params.put("serverId", "17952");
                } else {
                    params.put("areaId", "948");
                    params.put("serverId", "17953");
                }
            }
        }
        else if(goodsInfoAndAttrValueDto.getGameName().equals("三角洲行动")){
            params.put("gameId", "216");
            params.put("areaId", "1141");
            if (goodsInfoAndAttrValueDto.getCarrierName().equals("QQ")) {
                params.put("serverId", "21363");
            } else {

                params.put("serverId", "21908");
            }
        }
        else if(goodsInfoAndAttrValueDto.getGameName().equals("使命召唤手游")){
            if (goodsInfoAndAttrValueDto.getSystemName().equals("安卓")) {
                if (goodsInfoAndAttrValueDto.getCarrierName().equals("QQ")) {
                    params.put("areaId", "574");
                    params.put("serverId", "15071");
                } else {
                    params.put("areaId", "574");
                    params.put("serverId", "15073");
                }
            } else {
                if (goodsInfoAndAttrValueDto.getCarrierName().equals("QQ")) {
                    params.put("areaId", "576");
                    params.put("serverId", "15075");
                } else {
                    params.put("areaId", "576");
                    params.put("serverId", "15077");
                }
            }
        }

        //属性匹配
        String substring = salePartner.getSaleName().substring(salePartner.getSaleName().indexOf("_")+1);
        InterAttr interAttr = interAttrMapper.selectInterAttrByConfig(substring, goodsInfoAndAttrValueDto.getGameId());
        params.put("gameId", interAttr.getInterGameId());
        //区服
        builderServer(goodsInfoAndAttrValueDto, params, interAttr.getServer());
        //开始匹配单选属性
        builderRadioAttr(goodsInfoAndAttrValueDto, params, interAttr.getRadioAttr());
        //开始匹配多选属性
        builderCheckAttr(goodsInfoAndAttrValueDto, params, interAttr.getCheckAttr());

        params.put("goodsNum", "1");
        String bigTitle = "";
        if (StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getTitle())) {
            bigTitle = goodsInfoAndAttrValueDto.getTitle().replace("*", "").replace("+", "");
        } else if (StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getDes())) {
            bigTitle = goodsInfoAndAttrValueDto.getDes().replace("*", "").replace("+", "");
        }
        if (bigTitle.length() > 800) {
            bigTitle = bigTitle.substring(0, 800);
        }

        params.put("bigTitle", bigTitle.replace(";", "").replace("✨",""));
        params.put("price", goodsInfoAndAttrValueDto.getPrice().intValue());
        String goodsDecs = "";
        if (goodsInfoAndAttrValueDto.getDes().length() > 1000) {
            goodsDecs = goodsInfoAndAttrValueDto.getDes().substring(0, 1000).replace("*", "");
        } else {
            goodsDecs = goodsInfoAndAttrValueDto.getDes().replace("*", "");
        }
        params.put("goodsDecs", goodsDecs.replace(";", "").replace("✨","").replace("+",""));


        if(StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getTitleImg())) {
            params.put("thumbnail", goodsInfoAndAttrValueDto.getTitleImg());
        }else {
            params.put("thumbnail", LCConstant.defaultImg);
        }
        GoodsInfoImg goodsInfoImg = new GoodsInfoImg();
        goodsInfoImg.setGoodsId(goodsInfoAndAttrValueDto.getId());
        goodsInfoImg.setType(Constants.STR_1);
        List<GoodsInfoImg> infoImgs = goodsInfoImgMapper.selectGoodsInfoImgList(goodsInfoImg);
        if(infoImgs.size()>148){
            infoImgs = infoImgs.subList(0,148);
        }
        if(CollectionUtils.isNotEmpty(infoImgs)) {
            params.put("goodsImages", infoImgs.stream().map(i -> i.getImgUrl()).collect(Collectors.joining(",")));
        }

        String cover = MapUntils.getCover(params);
        String covers = cover + "key=" + salePartner.getSaleKey();
        log.info("加密参数===" + covers);
        String sign = DigestUtils.md5Hex(covers);
        params.put("sign", sign);
        return params;
    }

    private void builderCheckAttr(GoodsInfoAndAttrValueDto goodsInfoAndAttrValueDto, Map params, String checkAttr) {
        /**
         * 1、先查询自定义中所有多选的字段
         * 2、再查该账号单选字段中的选项
         * 3、再去接口属性匹配表过滤
         */
        Field[] declaredFields = goodsInfoAndAttrValueDto.getClass().getDeclaredFields();
        JSONObject checkAttrJson = JSONObject.parseObject(checkAttr);
        String interCheckBoxReqs = checkAttrJson.getString("interCheckBoxReqs");
        List<JSONObject> checkJsonList = JSONObject.parseArray(interCheckBoxReqs, JSONObject.class);
        if (org.springframework.util.CollectionUtils.isEmpty(checkAttrJson)) {
            throw new GlobalException("接口多选属性暂未配置");
        }

        GameAttrTemplate gameAttrTemplate = new GameAttrTemplate();
        gameAttrTemplate.setGameId(goodsInfoAndAttrValueDto.getGameId());
        gameAttrTemplate.setIsEnable("0");
        List<String> types = new ArrayList<>();
        types.add("checkbox");
        types.add("boxradio");
        gameAttrTemplate.setFieldTypes(types);
        List<GameAttrTemplate> checkAttrTemplates = gameAttrTemplateMapper.selectGameAttrTemplateList(gameAttrTemplate);


        for (JSONObject object : checkJsonList) {
            String interCheckBoxReqs1 = object.getString("interCheckBoxReqs");
            List<JSONObject> checkJsonList2 = JSONObject.parseArray(interCheckBoxReqs1, JSONObject.class);
            if(CollectionUtils.isNotEmpty(checkJsonList2)) {
                String jiaoyan = checkJsonList2.get(0).getString("interCheckBoxReqs");
                List<JSONObject> jiaoyanList = JSONObject.parseArray(jiaoyan, JSONObject.class);
                if (CollectionUtils.isNotEmpty(jiaoyanList)) {
                    for (JSONObject object2 : checkJsonList2) {
                        String string = "";
                        String twoKey = "";
                        for (GameAttrTemplate attrTemplate : checkAttrTemplates) {

                            String aavName = attrTemplate.getAavName();
                            for (Field declaredField : declaredFields) {
                                String name = declaredField.getName();
                                if (aavName.equals(name)) {
                                    declaredField.setAccessible(true);
                                    Object o = null;
                                    try {
                                        o = declaredField.get(goodsInfoAndAttrValueDto);
                                    } catch (IllegalAccessException e) {
                                        throw new GlobalException("多选项" + attrTemplate.getFieldName() + "匹配错误");
                                    }
                                    String oneValue = String.valueOf(o);
                                    String interCheckBoxReqsStr = object2.getString("interCheckBoxReqs");
                                    //开始匹配二级属性
                                    List<JSONObject> jsonObjects2 = JSONObject.parseArray(interCheckBoxReqsStr, JSONObject.class);
                                    /**
                                     * 咱们的f字段  多选项都是用空格 隔开，用,号切割数组，跟匹配的数据匹配、匹配上说明此账号勾选的有此属性
                                     */
                                    for (JSONObject jsonObject1 : jsonObjects2) {
                                        twoKey = jsonObject1.getString("id").split(",")[1];
                                        String[] split1 = oneValue.split(",");
                                        String ydConfigId1 = jsonObject1.getString("YdConfigId");
                                        for (String s : split1) {
                                            if (Objects.equals(s, ydConfigId1)) {
                                                String id = jsonObject1.getString("id");
                                                string += "," + id.split(",")[0];
                                            }
                                        }
                                    }
                                }
                            }
                        }
                        if (StringUtils.isNotEmpty(string)) {
                            params.put(object.getString("id"), object2.getString("id").split(",")[0]);
                            params.put(twoKey, string.substring(1).trim());
                        }
                    }
                } else {
                    String string = "";
                    for (GameAttrTemplate attrTemplate : checkAttrTemplates) {

                        String aavName = attrTemplate.getAavName();
                        for (Field declaredField : declaredFields) {
                            String name = declaredField.getName();
                            if (aavName.equals(name)) {
                                declaredField.setAccessible(true);
                                Object o = null;
                                try {
                                    o = declaredField.get(goodsInfoAndAttrValueDto);
                                } catch (IllegalAccessException e) {
                                    throw new GlobalException("多选项" + attrTemplate.getFieldName() + "匹配错误");
                                }
                                String oneValue = String.valueOf(o);
                                String interCheckBoxReqsStr = object.getString("interCheckBoxReqs");
                                //开始匹配二级属性
                                List<JSONObject> jsonObjects2 = JSONObject.parseArray(interCheckBoxReqsStr, JSONObject.class);
                                /**
                                 * 咱们的f字段  多选项都是用空格 隔开，用,号切割数组，跟匹配的数据匹配、匹配上说明此账号勾选的有此属性
                                 */
                                for (JSONObject jsonObject1 : jsonObjects2) {
                                    String[] split1 = oneValue.split(",");
                                    String ydConfigId1 = jsonObject1.getString("YdConfigId");
                                    if(StringUtils.isNotEmpty(ydConfigId1)) {
                                        ydConfigId1 = ydConfigId1.replace(" ", "");
                                        for (String s : split1) {
                                            if (Objects.equals(s, ydConfigId1)) {
                                                String InterConfigId2 = jsonObject1.getString("InterConfigId");
                                                InterConfigId2 = InterConfigId2.split(",")[0];
                                                string += "," + InterConfigId2;
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                    if (StringUtils.isNotEmpty(string)) {
                        params.put(object.getString("id"), string.substring(1).trim());
                    }
                }
            }
        }
    }

    /**
     * 开始匹配单选属性
     *
     * @param goodsInfoAndAttrValueDto
     * @param params
     * @param radioAttr
     */
    private void builderRadioAttr(GoodsInfoAndAttrValueDto goodsInfoAndAttrValueDto, Map params, String radioAttr) {
        //========================开始匹配单选属性=====================//
        JSONObject jsonObject = JSONObject.parseObject(radioAttr);
        String interRadioReqs = jsonObject.getString("interRadioReqs");
        log.info(JSONObject.toJSONString(interRadioReqs));
        List<JSONObject> jsonObjects = JSONObject.parseArray(interRadioReqs, JSONObject.class);
        if (!org.springframework.util.CollectionUtils.isEmpty(jsonObjects)) {
            /**
             * 1、先查询自定义中所有单选的字段
             * 2、再查该账号单选字段中的选项
             * 3、再去接口属性匹配表过滤
             */
            GameAttrTemplate gameAttrTemplate = new GameAttrTemplate();
            gameAttrTemplate.setGameId(goodsInfoAndAttrValueDto.getGameId());
            gameAttrTemplate.setIsEnable("0");
            gameAttrTemplate.setFieldType("radio");
            List<GameAttrTemplate> gameAttrTemplates = gameAttrTemplateMapper.selectGameAttrTemplateList(gameAttrTemplate);
            Field[] declaredFields = goodsInfoAndAttrValueDto.getClass().getDeclaredFields();


            List<JSONObject> defObjects = new ArrayList<>();
            defObjects.addAll(jsonObjects);
            for (JSONObject object : jsonObjects) {
                for (GameAttrTemplate attrTemplate : gameAttrTemplates) {
                    String aavName = attrTemplate.getAavName();
                    for (Field declaredField : declaredFields) {
                        String name = declaredField.getName();
                        if (aavName.equals(name)) {
                            //一级属性
                            //注意 YdConfigId 对应的是 f字段对应的 id
                            if (Objects.equals(object.getLong("YdConfigId"), attrTemplate.getId())) {
                                String InterConfigId = object.getString("InterConfigId");
                                defObjects.remove(object);//如果匹配上，则去掉
                                String interRadioReqs1 = object.getString("interRadioReqs");
                                List<JSONObject> jsonObjects2 = JSONObject.parseArray(interRadioReqs1, JSONObject.class);
                                declaredField.setAccessible(true);
                                try {
                                    //获取选择的值 例如  实名中的可二次
                                    Object o = declaredField.get(goodsInfoAndAttrValueDto);
                                    String oneValue = String.valueOf(o);
                                    List<JSONObject> twoAttr = jsonObjects2.stream().filter(j -> StringUtils.isNotEmpty(j.getString("YdConfigId"))?j.getString("YdConfigId").contains(oneValue):"111".contains(oneValue)).collect(Collectors.toList());
                                    String interConfigName = object.getString("InterConfigName");
                                    String defaultValue = object.getString("defaultValue");
                                    if (org.springframework.util.CollectionUtils.isEmpty(twoAttr)) {
                                        if (StringUtils.isNotEmpty(defaultValue)) {
                                            if(defaultValue.contains(",")) {
                                                defaultValue = defaultValue.split(",")[0];
                                                params.put(InterConfigId, defaultValue);
                                            }
                                        }
                                    }
//                                if (org.springframework.util.CollectionUtils.isEmpty(twoAttr) && StringUtils.isEmpty(defaultValue)) {
//                                    throw new GlobalException("属性" + interConfigName + " 接口要求必传，但是暂未匹配到，请设置默认值");
//                                }
                                    if (!org.springframework.util.CollectionUtils.isEmpty(twoAttr)) {
                                        JSONObject jsonObject2 = twoAttr.get(0);
                                        String interConfigId2 = jsonObject2.getString("InterConfigId");
                                        if(interConfigId2.contains(",")){
                                            interConfigId2 = interConfigId2.split(",")[0];
                                        }
                                        params.put(InterConfigId, interConfigId2);
                                    }
                                } catch (Exception e) {
                                    throw new GlobalException("单选项" + attrTemplate.getFieldName() + "匹配错误");
                                }
                            }
                        }
                    }
                }
            }
            //开始匹配默认值
            for (JSONObject object : defObjects) {
                JSONObject att = new JSONObject();
                String id = object.getString("id");
                interRadioReqs = object.getString("interRadioReqs");
                jsonObjects = JSONObject.parseArray(interRadioReqs, JSONObject.class);
                for (JSONObject objects : jsonObjects) {
                    if(StringUtils.isNotEmpty(objects.getString("defaultValue"))){
                        if(objects.getString("defaultValue").contains(",")) {
                            params.put(id, objects.getString("defaultValue").split(",")[0]);
                        }
                    }
                }
            }
        }
    }

    private void builderServer(GoodsInfoAndAttrValueDto goodsInfoAndAttrValueDto, Map params, String server) {
        //========================开始匹配区服属性=====================//
        JSONObject jsonObject = JSONObject.parseObject(server);
        //开始匹配一级区服
        String interServeReqs = jsonObject.getString("interServeReqs");

        if (Objects.equals(goodsInfoAndAttrValueDto.getGameType(), "0")) {
            List<JSONObject> oneServer = JSONObject.parseArray(interServeReqs, JSONObject.class);
            for (JSONObject object : oneServer) {
                String ydServeId = object.getString("YdServeId");
                if (StringUtils.isNotEmpty(ydServeId)) {
                    ydServeId = ydServeId.replace(",", "").replace(" ", "");
                    if (goodsInfoAndAttrValueDto.getSystemId().toString().equals(ydServeId)) {
                        params.put(object.getString("id").split(",")[0],object.getString("id").split(",")[1]);
                        String interServerRes = object.getString("interServerRes");
                        List<JSONObject> oneServers = JSONObject.parseArray(interServerRes, JSONObject.class);
                        for (JSONObject object2 : oneServers) {
                            ydServeId = object2.getString("YdServeId");
                            if(StringUtils.isNotEmpty(ydServeId)) {
                                ydServeId = ydServeId.replace(",", "").replace(" ", "");
                                if (Objects.equals(goodsInfoAndAttrValueDto.getSystemId().toString()+goodsInfoAndAttrValueDto.getCarrierId(), ydServeId)) {
                                    params.put(object2.getString("id").split(",")[0],object2.getString("id").split(",")[1]);
                                    break;
                                }
                            }
                        }
                    }
                }
            }
        } else {
            List<JSONObject> oneServer = JSONObject.parseArray(interServeReqs, JSONObject.class);
            for (JSONObject object : oneServer) {
                String ydServeId = object.getString("YdServeId");
                if (StringUtils.isNotEmpty(ydServeId)) {
                    ydServeId = ydServeId.replace(",", "").replace(" ", "");
                    if (goodsInfoAndAttrValueDto.getGroupId().toString().equals(ydServeId)) {
                        params.put(object.getString("id").split(",")[0],object.getString("id").split(",")[1]);
                        String interServerRes = object.getString("interServerRes");
                        List<JSONObject> oneServers = JSONObject.parseArray(interServerRes, JSONObject.class);
                        for (JSONObject object2 : oneServers) {
                            ydServeId = object2.getString("YdServeId");
                            if(StringUtils.isNotEmpty(ydServeId)) {
                                ydServeId = ydServeId.replace(",", "").replace(" ", "");
                                if (Objects.equals(goodsInfoAndAttrValueDto.getServerId().toString(), ydServeId)) {
                                    params.put(object2.getString("id").split(",")[0],object2.getString("id").split(",")[1]);
                                    break;
                                }
                            }
                        }
                    }
                }
            }
        }
    }

    @Override
    public AjaxResult delGame(GoodsInfoAndAttrValueDto goodsInfoAndAttrValueDto, SalePartner salePartner) {
        Map<String, Object> params = params(goodsInfoAndAttrValueDto, "3", salePartner);
        Map<String, Object> result = new HashMap<>();
        String response = HttpUtils.doPostForm("http://interface.sxds.com/api/goods/goodsReceive", params, null);
        log.info("神仙删除接口请求参数={}", JSONObject.toJSONString(params));
        log.info("神仙删除接口返回参数={}", response);
        JSONObject resultJson = JSONObject.parseObject(response);
        if (!Objects.isNull(resultJson)) {
            if (!"0".equals(resultJson.getString("code"))) {
                result.put("code", 500);
            } else {
                result.put("code", 200);
            }
            result.put("msg", resultJson.getString("msg"));
        } else {
            result.put("code", 500);
            result.put("msg", "删除失败");
        }
        result.put("req", JSONObject.toJSONString(params));
        result.put("res", response);

        return AjaxResult.success(result);
    }

    public static void main(String[] args) {
        Map<String, String> param = new HashMap<>();
        param.put("gameId", "216");
        // gameList
        // gamefilter
        String response = HttpUtil.doGet("http://interface.sxds.com/api/comm/gamefilter", param, null);
        log.info(response);
    }


}
